package com.jiangxiaofei.citycloud.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * 作者: JiangXfei
 * 日期: 2017/9/21 0021
 */

public class CarPartInfoPagerAdapter extends PagerAdapter {
    List<View> viewList;
    Context mContext;

    public CarPartInfoPagerAdapter(List<View> viewList, Context mContext) {
        this.viewList = viewList;
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return viewList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(viewList.get(position));
        return viewList.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(viewList.get(position));
    }
}
